package com.github.soiff.shadow.plugin.helper;

import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;

import java.io.IOException;

/**
 * Created by Soiff on 2016/05/20.
 *
 * @author : Soiff
 */
public class ModHelper implements Helper<Integer> {
    @Override
    public CharSequence apply(Integer source, Options options) throws IOException {
        return (source.intValue() + 1) % ((Integer)options.param(0)).intValue() == 0?options.fn():options.inverse();
    }
}
